package by.bsu.scs.presentation.tabledecorator;

import org.displaytag.decorator.TableDecorator;

import by.bsu.scs.model.TaskAttachment;

/**
 * @author Alexey Hursevich
 * @version 1.0
 * 
 * Unchecked tasks table decorator bean.
 * Gets appropriate data when displaying the the table
 * of unchecked task for instructor.
 * 
 */
public class UncheckedTaskDecorator extends TableDecorator {
        
        private static final String NAME_PATTERN = "%s %s";
        
        public String getStudentName() {
            TaskAttachment ta =  (TaskAttachment)( ((Object[])getCurrentRowObject())[0] );
            return String.format( NAME_PATTERN,
                                                      ta.getUser().getUserSurname(),
                                                      ta.getUser().getUserName() );
        }
        
        public String getTaskDiscriptionLink() {
            TaskAttachment ta =  (TaskAttachment)( ((Object[])getCurrentRowObject())[0] );
            return ta.getTask().getTaskTitle();
        }
        
        public String getViewLink() {
           // TaskAttachment ta =  (TaskAttachment)( ((Object[])getCurrentRowObject())[0] );
            return "View Link";
        }
        
        public String getMarkLink() {
           // TaskAttachment ta =  (TaskAttachment)( ((Object[])getCurrentRowObject())[0] );
            return "Mark Link";
        }

}
